<?php

namespace App\Services\AutoRefundProductOrder;

use App\Models\Order;

class AutoRefundProductOrder
{
	protected $refund;
	
	public function __construct(Order $order)
	{
		$this->order = $order;
	}
	
	public function refuse()
	{
		if ($this->refund->refund_status !== 'applied') return;
		
		$this->refund->update(['refund_status' => 'refused']);
	}
	
	public function refund()
	{
		$order = $this->order;
		cashier($order->paid_method)->refundOrder($this->order);
	}
}
